package Test;

import java.util.Random;
import java.util.Scanner;

public class Test02 {
    //猜数字小游戏
    public static void main(String[] args) {
        Random random = new Random();
        int randNum = random.nextInt(100);
        //System.out.println(randNum);
        Scanner sc = new Scanner(System.in);
        while(true){
            System.out.println("请输入你要猜的数字：");
            int num = sc.nextInt();
            if(num>randNum){
                System.out.println("猜大了！");
            }else if(num==randNum){
                System.out.println("恭喜你，猜对了");
                break;
            }else {
                System.out.println("猜小了！");
            }
        }
    }
    public static void main3(String[] args) {
        int sum = 0;
        for (int k = 1; k <=5; k++) {
            int ret = 1;
            for (int i = 1; i <=k; i++) {
                ret*=i;
            }
            sum+=ret;
        }
        System.out.println(sum);
    }
    public static void main2(String[] args) {
        //输出1-100之间既能被3整除，又能被5整除的数
        //用continue或者break
        for(int i=1;i<=100;i++){
            if(i%3==0&&i%5==0){
                System.out.println(i);
                continue;
            }
        }
    }
    public static void main1(String[] args) {
        //System.out.println("\\\"");
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        if (year%100==0){
            if (year%400==0){
                System.out.println("世纪闰年");
            } else {
                System.out.println("非世纪闰年");
            }
        }
        else {
            if (year%4==0){
                System.out.println("普通闰年");
            } else {
                System.out.println("不是闰年");
            }
        }
    }
}
